<?php
	namespace app\controllers;
	use yii\web\Controller;
	class ResponseController extends Controller{
		public function actionIndex(){
			$res = \YII::$app->response;
			//$res->statusCode = '404';
			//$res->headers->add('pragma','no-cache');//删除缓存
			$res->headers->set('pragma','max-age=5');//缓存存在五秒
			$res->headers->remove('pragma');//移除http头的pragma

			//跳转
			//$res->headers->add('location','http://www.baidu.com');
			$this->redirect('http://www.baidu.com',302);
			
			//文件下载
			$res->headers->add("content-disposition","attachment;filename='sbb.jpg'");
			$res->sendFile('sbb.jpg');
		}
	}
	
?>